package c2.group.business.tb.boss;

import c2.advanced.business.base.KvData;
import cate.game.play.param.HpExtend;
import cate.game.pvp.throne.data.boss.TBChampionBossReplay;
import cate.game.pvp.throne.dto.TBBossDTO;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@NoteClass("王座争霸-淘汰赛基础数据")
@Slf4j
public class TBBossStatus extends KvData {

    @NoteField("冠军的唯一id")
    public String championUid;

    @NoteField("本期使用过的英雄唯一id")
    public Set<String> heroUids;

    @NoteField("挑战记录")
    public List<TBChampionBossReplay> replays;

    @NoteField("血量继承")
    public HpExtend hpExtend;

    @NoteField("是否击杀")
    public boolean kill;

    @NoteField("历史击杀次数")
    public int totalKillTime;


    @Override
    public void init(String theKey) {
        super.init(theKey);
        if (heroUids == null) {
            heroUids = new HashSet<>();
        }
        if (replays == null) {
            replays = new ArrayList<>();
        }
        if (hpExtend == null) {
            hpExtend = new HpExtend();
        }
    }

    public TBBossDTO toDTO() {
        TBBossDTO dto = new TBBossDTO();
        dto.championUid = championUid;
        dto.heroUids = heroUids;
        dto.replays = replays;
        dto.hpExtend = hpExtend;
        dto.kill = kill;
        dto.totalKillTime = totalKillTime;
        return dto;
    }


    public void clear() {
        championUid = null;
        heroUids.clear();
        replays.clear();
        hpExtend.clear();
        kill = false;
    }


    public void setChampion(String roleUid) {
        championUid = roleUid;
    }
}
